package com.wzy.dao;

import com.wzy.pojo.Book4;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository
public interface BookRepository extends JpaRepository<Book4,Integer> {

    //根据作者和状态查找图书信息
    Book4 findByAuthorAndStatus(String author,String status);

    //根据id删除图书信息
    @Modifying
    @Transactional
    @Query("delete from Book4 where id=:id")
    Integer deleteBook4ById(@Param("id") Integer integer);

}
